<!-- 供应商 弹窗 list 选择 -->
<template>
  <el-dialog
    v-if="dialogListVisibleBool" title="选择租户"
    :visible.sync="dialogListVisibleBool"
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    :show-close="false"
    class="zjm_dialog_tenant_method_list"
    width="500px"
  >
    <div v-if="dialogList.length!=0">
      <!-- @input="handleRowChange" -->
      <el-radio-group v-model="selectId">
        <el-radio v-for="(item,index) in dialogList" :key="index" :label="item.id" class="zjm_dialog_tenant_method_value">
          {{ item.name }}
        </el-radio>
      </el-radio-group>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" size="small" @click="onSubmit">确 定</el-button>
      <el-button size="small" @click="resetSubmit">取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
// 混入
import { dialogListMixins } from '@/mixins/publicMixins/dialogListMixins'

export default {
  mixins: [dialogListMixins],
  prop: { },
  inject: {
    formProvide: {
      default: () => ({})
    }
  }, // --> ------ form接值 +选择 弹窗 必加
  data() {
    return {}
  },
  created() { },
  methods: {
    /**
     * @description: 触发 序号选择
     * @author: 张佳敏
     */
    // handleRowChange(e) {
    //   console.log(e)
    //   var RowArr = []
    //   this.dialogList.forEach((item, index) => {
    //     if (item.list.length != 0) {
    //       item.list.forEach((ele) => {
    //         if (ele.check == true) {
    //           RowArr.push(ele)
    //         }
    //       })
    //     }
    //   })
    //   this.selectRowArr = RowArr
    // },

    /**
     * @description: 触发 提交 、确认
     * @author: 张佳敏
     */
    onSubmit() {
      console.log(this.selectId)
      if (this.selectId == null) {
        this.msgAlt('请选择对应的租户登录', 'error')
        return
      } else {
        localStorage.setItem('tenantId', this.selectId)
        this.formProvide.tenantMethodFun(this.selectId)
        this.resetSubmit()
      }
    },

    /**
     * @description: 触发 取消
     * @author: 张佳敏
     */
    resetSubmit() {
      this.selectRowArr = []
      this.dialogListVisibleBool = false
    }
  }
}
</script>
